package com.example.demo.batch.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.stereotype.Component;

/**
 * @author huangke
 * @description xxx
 * @date 2021/1/21
 */
@Slf4j
@Component
public class ConsoleJobEndListener extends JobExecutionListenerSupport {
    @Override
    public void afterJob(JobExecution jobExecution) {
        if(jobExecution.getStatus() == BatchStatus.COMPLETED){
            log.info("console batch job complete!");
        }
    }

    @Override
    public void beforeJob(JobExecution jobExecution) {
        log.info("哎呀  开始了哦！");
    }
}